﻿using System.Threading.Channels;
using Digitalmes.Core.Common.Interfaces;

namespace Digitalmes.Infrastructure.MessageBrokers;

public static class ChannelQueueServiceCollectionExtensions
{
    /// <summary>
    /// 注册基于 <see cref="Channel{}"/> 的消息队列服务。
    /// </summary>
    /// <param name="services"></param>
    /// <returns></returns>
    public static IServiceCollection AddMessageQueueSetup(this IServiceCollection services)
    {
        services.AddSingleton(typeof(IMessageQueue<>), typeof(DefaultChannelQueue<>));

        return services;
    }
}
